﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace Pg.BioMedics.SDR.ServiceAgents.Configuration
{
    /// <summary>
    /// Represents service credentials configuration entry
    /// </summary>
    public sealed class ServiceCredentialsElement : ConfigurationElement
    {
        #region Constants

        private const string ModeProperty = "mode";
        private const string UserNameProperty = "userName";
        private const string PasswordProperty = "password";

        internal const string BasicMode = "basic";
        internal const string WindowsMode  = "windows";

        #endregion

        #region Properties

        /// <summary>
        /// Gets / sets credentials mode
        /// </summary>
        [ConfigurationProperty(ModeProperty)]
        [DefaultSettingValue(BasicMode)]
        public string Mode
        {
            get
            {
                return this[ModeProperty] as string;
            }

            set
            {
                this[ModeProperty] = value;
            }
        }

        /// <summary>
        /// Gets / sets user name for service realm
        /// </summary>
        [ConfigurationProperty(UserNameProperty)]
        public string UserName
        {
            get
            {
                return this[UserNameProperty] as string;
            }

            set
            {
                this[UserNameProperty] = value;
            }
        }

        /// <summary>
        /// Gets / sets password for service realm
        /// </summary>
        [ConfigurationProperty(PasswordProperty)]
        public string Password
        {
            get
            {
                return this[PasswordProperty] as string;
            }

            set
            {
                this[PasswordProperty] = value;
            }
        }

        #endregion
    }
}
